package com.zhuna.www.dao;

import com.zhuna.www.po.RechargeRecord;
import com.zhuna.www.util.JDBCutil;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

public class RechargeDAO {

    public int insertRecord(Connection conn,RechargeRecord record) throws SQLException {
        String sql = "INSERT INTO recharge_records (user_id, amount, transaction_id, status) " +
                "VALUES (?, ?, ?, ?)";
        try (PreparedStatement stmt = conn.prepareStatement(sql)){
            stmt.setInt(1, record.getUserId());
            stmt.setDouble(2, record.getAmount());
            stmt.setString(3, record.getTransactionId());
            stmt.setString(4,record.getStatus().name());
            return stmt.executeUpdate();

        }
        }


    }

